#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int left = 0;
        int right = 1;
        int size = nums.size();
        while (right < size) {
            if (nums[left] != nums[right]) {
                left++;
                swap(nums[left], nums[right]);
                right++;
            }
            else {
                while (right < size && nums[left] == nums[right]) {
                    right++;
                }
                if (right == size)
                    break;
                else {
                    left++;
                    swap(nums[left], nums[right]);
                    right++;
                }
            }
        }
        return left + 1;
    }
};
int main()
{
	return 0;
}